// TreeDlg.h : header file
//

#pragma once
#include "afxcmn.h"
#include "WatchDir.h"


// CTreeDlg dialog
class CFolderHidingToolDlg : public CDialog
{
// Construction
public:
	CFolderHidingToolDlg(CWnd* pParent = NULL);	// standard constructor

    CString GetTreePath(HTREEITEM hItem);

// Dialog Data
	enum { IDD = IDD_TREEDEMO_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support

private:
// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
    afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg HCURSOR OnQueryDragIcon();
    afx_msg LRESULT AddNewVolume(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnRefreshVolumeList(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnRefreshTree(WPARAM wParam, LPARAM lParam);
    afx_msg void OnBnClickedHideButton();
    afx_msg void OnBnClickedShowButton();
    afx_msg void OnBnClickedApplyButton();
    afx_msg void OnMainMenuExit();
    afx_msg void OnMainMenuAbout();
    afx_msg void OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnTvnItemexpandingTree(NMHDR *pNMHDR, LRESULT *pResult);
	DECLARE_MESSAGE_MAP()

public:
    CTreeCtrl m_ctrlTree;
    CImageList m_imageList;
    CMenu m_wndMainMenu;
    CStatusBar m_bar;
    CListCtrl m_ctrlList;
    HANDLE hVolumeEvent;

    bool FillTreeWithFolders(CString &sPath, HTREEITEM hItem, bool bFill = true);
    void DividePath(CString &sPath1, CString &sPath2, int nStart);
    bool FillDirecoryInTree(HTREEITEM hItem);
    bool EmptyVolumeInTree(HTREEITEM hItem);
    bool DeleteItemsFromFolder(HTREEITEM hItem);
    bool AddNewItemsToTree(HTREEITEM hItem);
    bool GetFolderIcon(const CStringArray &arString);
    bool RefreshRootIconsAndNames(CStringArray &arRootItems);
    void ClearRulesList(void);
    bool NotificateDriver(void);
    bool RefreshTree(HTREEITEM hRootItem);
    bool RefreshDrive(HTREEITEM hDrive);
};
